<?php
error_reporting(E_ALL && ~ E_NOTICE);
session_start();
/**
 * Created by PhpStorm.
 * User: Quyet
 * Date: 12/5/2014
 * Time: 3:09 PM
 */

include "header.php";
include "../db/dbConnect.php";
?>
<?php
if(($_SERVER['REQUEST_METHOD']=="GET") && ($_GET["user_profile"]!=0)){
    $idu=$_GET["user_profile"];
    $host=($idu==$_SESSION['LoginData']['iduser'])?1:0;


}else {
    //unset($user);
    $host=1;
    $idu=$_SESSION['LoginData']['iduser'];
}

$sql='select * from u_user where iduser='.$idu.' AND deleted =0 ';

$result=mysql_query($sql);
echo mysql_error();
$user=array();
$user=mysql_fetch_array($result);

?>
<div class="content" id="ctrl" vl="<?php echo $user['iduser']; ?>">
        <div class="wrap bgProfile bd2">
            <div class="pTop pGrid"><br/>
                <div class="wrap">
                    <div class="imgAvatar left">
                        <?php $avatar=($user['avatar'])?$user['avatar']:"avatar_default.jpg";?>

                        <img class="avatar" src="web/images/avatar/<?php echo $avatar ?>" alt="avatar" title="avatar"/>
                    </div>
                    <div class="infor left">
                        <div class="name"><span class="lstName"><?php echo $user['lstName']  ?></span><span class="fstName"><?php echo $user['fstName'] ?></span></div>
                        <div class="outline">
                            <ul class="outline">
                                <li><?php echo $y=date("Y")-date("Y",strtotime($user['birthday']))?> tuổi</li>
                                <li><?php echo $user['job'] ?></li>
                                <li><?php
                                        $q="select name from que_quan WHERE id=".$user['address'];
                                        $re=mysql_query($q);
                                        $addr=mysql_fetch_array($re);
                                        echo $addr['name'] ?></li>
                            </ul></div>
                    </div>
                    <div class="hMatch left w20p"></div>
                    <div class="hightMatch right w40p">

                        <?php for($i=1; $i<=4; $i++){ 
                            echo '<a class="link2Page icon mgIcon right" href="#"><img class="icon-small" src="web/images/avatar/'.$i.'.jpg" /></a>';
                        }?>

                    </div>
                    <div class="clear"> </div>
                </div>
            </div>
            <div class="mid-nav left w100p default">
                <div class="wrap blue">
                    <div class="clear"> </div>
                    <ul class="mid-menu">
                        <li class="left"><a class="link2Page link2uPage" href="web/member/about.php?user_profile=<?php echo $user['iduser']; ?>">Về tôi</a></li>
                        <li class="left"><a class="link2Page link2uPage hidden" href="web/member/album.php?user_profile=<?php echo $user['iduser']; ?>">Ảnh của tôi</a></li>
                        
                        <li class="left"><a class="link2Page link2uPage" href="web/member/question.php?user_profile=<?php echo $user['iduser']; ?>">Hỏi tôi</a></li>
                        <?php if($host==1) {?>
                        <li class="left"><a class="link2Page link2uPage" href="web/member/friendList.php?user_profile=<?php echo $user['iduser']; ?>">Tìm bạn</a></li>
                        <?php } ?>
                    </ul>
                </div>
                <div class="clear"> </div>
            </div>

            <div class="pLeft left w80p pGrid">

                <div class="clear"> </div>
            </div>
            <div class="pRight right w20p pGrid">
                <div class="visitor grid"><div class="hQ1 w100p hQ">Ai vừa ghé thăm bạn?</div>
                    <div class="wrapImg">
                        <?php for($i=1; $i<=8; $i++){
                            echo '<a class="link2Page icon right mgIcon2" href="#"><img class="icon-small" src="web/images/avatar/'.$i.'.jpg" /></a>';
                        }?>
                    </div>
                </div>
                <div class="like grid" ><div class="hQ1 w100p hQ">Ai đang thích bạn?</div>
                    <div class="wrapImg">
                        <?php for($i=1; $i<=8; $i++){
                            echo '<a class="link2Page icon right mgIcon2" href="#"><img class="icon-small" src="web/images/avatar/'.$i.'.jpg" /></a>';
                        }?>
                    </div>
                </div>
                <div class="clear"> </div>
            </div>
        </div>
    </div>
<script type="text/javascript">
    var id=$("#ctrl").attr('vl');
    $("a.link2uPage").on('click', function(e){
        e.preventDefault();
        var url=$(this).attr('href');
       $(".pLeft").load(url).show('slow');
    });
    $(".pLeft").load("web/member/about.php?user_profile="+id).fadeIn('slow');

    $(".hMatch").load("web/member/hightestmatch.php?iduser="+id);
</script>